package nc.task.hdysc;

import java.util.List;
import java.util.Map;

import nc.bs.dao.BaseDAO;
import nc.bs.dao.DAOException;
import nc.hdysc.engine.impl.BaseSyncDataImpl;
import nc.hdysc.engine.itf.ISyncTask;
import nc.hdysc.pub.BaseUtil;
import nc.jdbc.framework.processor.MapListProcessor;
import nc.vo.hdysc.agencylevel.AgencyLevelVO;
import nc.vo.hdysc.engine.SyncTaskVO;

public class TravelAgencyLevelTask extends BaseSyncDataImpl<AgencyLevelVO> implements ISyncTask<AgencyLevelVO> {

	
	//private SyncTaskVO syncTaskVO;
	public TravelAgencyLevelTask() throws DAOException, InstantiationException, IllegalAccessException, ClassNotFoundException {
		super( AgencyLevelVO.class);
	}

	public List<AgencyLevelVO> getDstDate() throws DAOException {
		List<AgencyLevelVO> agencyLevelList = (List<AgencyLevelVO>) dDao.retrieveAll(AgencyLevelVO.class);
		return agencyLevelList;
	}

	public List<Map<String, Object>> getSourceDate() throws DAOException {
		String sql = "select * from tbdlevel";
		List<Map<String, Object>> agencyLevelList = (List<Map<String, Object>>) sDao.executeQuery(sql, new MapListProcessor());
		return agencyLevelList;
	}

	public SyncTaskVO getSyncTask() throws DAOException {
		SyncTaskVO syncTask = null;
		BaseDAO dao = new BaseDAO();
		syncTask = (SyncTaskVO) dao.retrieveByPK(SyncTaskVO.class, "0001AA100000000062E3");
		return syncTask;
	}

	public AgencyLevelVO afterMethod(AgencyLevelVO t) {
		return t;
	}

	public int compare(AgencyLevelVO sVO, AgencyLevelVO dVO) {
		int compare = -1;
		String dName = dVO.getLevel_name();
		String sName = sVO.getLevel_name();
		if(BaseUtil.equals(dName,sName)){
			compare =  1;
		}
		return compare;
	}

	public AgencyLevelVO beforeUpdateOrInsert(AgencyLevelVO t) {
		return t;
	}

}
